package cn.cimoc.controller;


import cn.cimoc.constant.ConstantPool;
import org.springframework.web.bind.annotation.ModelAttribute;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class BaseController {

    protected HttpServletRequest request;

    protected HttpServletResponse response;

    /**
     * token中的username
     */
    protected String tUsername;

    protected Long uid;


    @ModelAttribute
    public void setBaseBizController(HttpServletRequest request, HttpServletResponse response) {
        this.request = request;
        this.response = response;
        tUsername = (String) request.getAttribute(ConstantPool.USERNAME);
        uid = (Long) request.getAttribute(ConstantPool.USER_ID);
    }
}
